<?php 
	$calendarLanguageTMP = explode('_',Yii::app()->getLanguage());
	$calendarLanguage = $calendarLanguageTMP[0] . '-' . strtoupper($calendarLanguageTMP[1]);
	
	if($calendarLanguageTMP[0] == 'en')
	{
		$calendarLanguage = 'en-GB';
	}
	
	if($calendarLanguageTMP[0] == 'es')
	{
		$calendarLanguage = 'es';
	}
	
	$periodos = array(
						'01'=>'01',
					);
	$anios = array();
	
	for ($i = date('Y')-10; $i < date('Y')+3;$i++)
	{
		$anios[$i]= $i; 
	}

	
	if($model->periodoingreso_periodo == '')
	{
		$model->periodoingreso_periodo = '01';
	}
	
	if($model->periodoingreso_anio == '')
	{
		$model->periodoingreso_anio = date('Y');
	}
	
	
?>
<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'periodo-ingreso-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note"><?php echo t('Campos con','nucleo_etiqueta');?><span class="required">*</span> <?php echo t('son requeridos','nucleo_etiqueta');?>.</p>

	<?php echo $form->errorSummary($model); ?>
	<fieldset>
		<fieldset>
			<div class="width_half">
			<?php 
				echo $form->labelEx($model,'periodoingreso_periodo');
				echo $form->dropDownList(
    							$model,
                                'periodoingreso_periodo',
                                $periodos
											);
				echo $form->error($model,'periodoingreso_periodo');
			?>
			</div>
		
			<div class="width_half">
			<?php 
				echo $form->labelEx($model,'periodoingreso_anio');
				echo $form->dropDownList(
    							$model,
                                'periodoingreso_anio',
                                $anios);
				echo $form->error($model,'periodoingreso_anio');
			?>
			</div>
		
			<div class="width_half">
			<?php 
				echo $form->labelEx($model,'periodoingreso_inicio');
				$this->widget(
								'zii.widgets.jui.CJuiDatePicker',
								array(
										'model'=>$model,
										'attribute'=>'periodoingreso_inicio',
				
										'language' => $calendarLanguage,
										'options' => array(
															'dateFormat'=>'dd/mm/yy',
															'changeMonth' => 'true',
															'changeYear' => 'true',
															'constrainInput' => 'false',
															'duration'=>'fast',
															'showAnim' =>'slide',
															'yearRange' => '1900:' . (date('Y')+2),
										),
										'htmlOptions'=>array()
								)
				);
				echo $form->error($model,'periodoingreso_inicio');
			?>
			</div>
		
			<div class="width_half">
			<?php 
				echo $form->labelEx($model,'periodoingreso_fin');
				$this->widget(
								'zii.widgets.jui.CJuiDatePicker',
								array(
										'model'=>$model,
										'attribute'=>'periodoingreso_fin',
				
										'language' => $calendarLanguage,
										'options' => array(
															'dateFormat'=>'dd/mm/yy',
															'changeMonth' => 'true',
															'changeYear' => 'true',
															'constrainInput' => 'false',
															'duration'=>'fast',
															'showAnim' =>'slide',
															'yearRange' => '1900:' . (date('Y')+2),
										),
										'htmlOptions'=>array()
								)
				);
				echo $form->error($model,'periodoingreso_fin');
			?>
			</div>
		</fieldset>
		
		<fieldset>
			<div class="row buttons">
				<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
			</div>
		</fieldset>
	</fieldset>
<?php $this->endWidget(); ?>

</div><!-- form -->